@layout('layouts.setup')

@section('setup')

<div class="container">
<div id="login-wraperbg"></div>
<center>

<!--[if IE 9 ]>
<div id="login-wraper-border-ie9">
<![endif]--> 
@if (!is_null(Session::get('login_errors')))
<div class="row-fluid" >
    <div class="span9">
        <div class="alert alert-error span8 pull-right" style="position:relative;margin-right: auto;margin-left: auto">
            <a class="close" data-dismiss="alert" href="#">×</a>
            <h4 class="alert-heading">Harap Maaf...</h4>
            @if(Session::get('login_errors'))
                <span class="text-error">Maaf, Kata Laluan Baru perlu antara 6-12 huruf.</span>
            @endif
        </div>
    </div>
</div>
<div class="row-fluid" >
    &nbsp;
</div>
@endif

        <div id="login-wraper-border">
            <div id="login-wraper">
  <!--{{ Form::open('console/auth/verifyupdate', 'POST', array('class'=>'form-actions','style'=>'border:1px solid #E5E5E5;margin:50px auto;padding:19px 29px 29px;max-width:400px;box-shadow:0 1px 2px rgba(0, 0, 0, 0.05)')) }}-->
  {{ Form::open('console/auth/verifyupdate', 'POST', array('class'=>'form-actions','style'=>'')) }}
  {{ Form::hidden('key',URI::segment(3)) }}
  <!--<h3>{{ Str::upper(Lang::line('global.passwordupdate')->get()) }}</h3>-->
  <legend>{{ Str::upper(Lang::line('global.passwordupdate')->get()) }}</legend>
  <div class="span12">{{ Label::important(Str::title(Lang::line('global.labelupdatepassword')->get())); }}</div>
  
  {{ Form::control_group(Form::label('oldpassword', Str::title(__('global.oldpassword'))),Form::xlarge_password('oldpassword',array('placeholder'=>Str::title(__('global.type').' '.__('global.oldpassword')),'required'))) }}
  {{ Form::control_group(Form::label('su_password', Str::title(__('global.newpassword'))),Form::xlarge_password('su_password',array('placeholder'=>Str::title(__('global.type').' '.__('global.newpassword')),'required'))) }}
  {{ Form::submit(Str::title(Lang::line('global.edit')->get().' '.Lang::line('global.password')->get()), array('class' => 'btn btn-info'))}}
  {{ Form::close()}}
            </div>
        </div>
<!--[if IE 9 ]>
</div>
<![endif]--> 
</center>
</div>

@endsection
@section('scripts')

<script type="text/javascript">

$(document).ready(function () {
    var intputElements = document.getElementsByTagName("INPUT");
    for (var i = 0; i < intputElements.length; i++) {
        intputElements[i].oninvalid = function (e) {
            e.target.setCustomValidity("");
            if (!e.target.validity.valid) {
                if (e.target.name == "oldpassword") {
                    e.target.setCustomValidity("Ruangan ini perlu diisi");
                }
                else {
                    e.target.setCustomValidity("Ruangan ini perlu diisi");
                }
            }
        };
    }
})

</script>

@endsection
